package g3pd.gradep.virdgm;

import java.util.*;

public class VirdGraph {
    Vector<VirdNode> nodes;
    VirdNode virdNode;
    
    VirdGraph() {
        this.nodes = new Vector<VirdNode>();
    }
    
    void addNode(VirdNode virdNode) {
        this.nodes.add(virdNode);
    }
    
    VirdNode getNode(int idNode) {
        for(int i = 0; i < nodes.size(); i++) {
            if((nodes.get(i)).getId() == idNode)
                virdNode = nodes.get(i);
        }
        return virdNode;
    }
    
    public int size() {
        return this.nodes.size();
    }
    
    @Override
    public String toString() {
        String str = "{";
        for(int i = 0; i < nodes.size(); i++) {
            str += nodes.get(i) + ", ";
        }
        return str + "}";
    }
}

class VirdNode {
    Integer idNode;
    Object adj;
    
    VirdNode(Integer id, Object adj) {
        this.idNode = id;
        this.adj = adj;
    }
    
    public Integer getId() {
        return idNode;
    }
    
    public Object getAdj() {
        return adj;
    }
    
    @Override
    public String toString() {
        return this.idNode + " : " + this.adj;
    }
}